<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link href="css/login.css" rel="stylesheet"/>
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="js/login.js"></script>
    <title>登录_忘记密码</title>
</head>
<body>
<div>
    <div id="header">
        <img class="back" src="images/back.png" alt="">
    </div>
    <div id="content">
        <div id="fp">
            <strong>忘记密码</strong>
        </div>
        <form action="" id="form">
            <select name="" id="area">
                <option value="">+86</option>
            </select>
            <input type="text" id="tell" placeholder="手机号码">
            <div id="msg"></div>
        </form>

        <div id="button">
            <button class="login">下一步</button>
        </div>
    </div>
</div>


<script>
    $(function () {
        $(".back").click(function(){
            $(window).attr('location',"login.html");
        });


        $(".login").click(function(){
            $.ajax({
                type: 'POST',
                url:`${localStorage.top}api/user/checkPhone`,
                data: {
                    mobile:$("#tell").val(),
                },

                success:function (data) {
                    console.log(data);
                    if(data.code==0){
                            $(window).attr('location',"login_resetCode.html");
                            localStorage.mobile=$("#tell").val();}
                        else {
                            $("#msg").html(data.msg)
                        }

                }

            });


        });
    })
</script>
</body>
</html>